home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-06 / segue.exe / BDSUPLST.PRG < prev    next >
Text File  |  1991-07-25  |  5KB  |  155 lines

  1. *.............................................................................
  2. *   Program Name: BDSUPLST.PRG      Copyright: HRF Associates, Inc.
  3. *   Date Created: 07/24/91           Language: Clipper
  4. *   Time Created: 03:32:51             Author: Bob Fogle (203) 866-4324
  5. *.............................................................................
  6. *
  7. * Supplemental SEGUE function for listing objects in the bindery
  8. * with Supervisor equivalences.
  9. *
  10. FUNCTION SUPLST_(obtp, obnm, aobnm, aobtp)
  11. *Purpose : To list objects in the bindery with Supervisor equivalences.
  12. *Usage     : SUPLST_(<expN1>, <expC2> [,<expC3>] [,<expC4>])
  13. *        :
  14. * Where  : <expN1> = Search Object Type
  15. *        : <expC2> = Search Object Name. (1..47) [No spaces)
  16. *        : <expC3> = Array Name for Returned object Names 
  17. *        : <expC4> = Array Name for Returned object Types 
  18. *        :
  19. *On Error: <expN>, where:
  20. *        :      0 if Successful.
  21. *        :  - 101..-103 if Invalid Parameter.
  22. *        :      The last two digits indicates which parameter was invalid.
  23. *        :  - 150 if Server Out Of Memory.
  24. *        :  - 239 if Invalid Name.
  25. *        :  - 252 if No Such Object
  26. *        :  - 254 if Server Bindery Locked.
  27. *        :  - 255 if Bindery Failure.
  28. *        :
  29. * NOTES  :  The Search User Name may contain wildcard specifiers.
  30. *        :
  31. *Found in:  BDUSRLST.PRG
  32. *        :
  33. LOCAL mobnm, exitflag,mpassbg,mpassen,pnam :="SECURITY_EQUALS"
  34. PRIVATE rtn, rtn1, aobid[0], arobid[0], arobnm[0], arobtp[0], arprvl[0]
  35. * Check to make sure passed variable types are correct.
  36. rtn = 0
  37. do while .t.
  38.   if valtype(obtp)<>'N'.AND.obtp<>nil
  39.     rtn = -101
  40.     exit
  41.   elseif valtype(obnm)<>'C'.AND.obnm<>nil
  42.     rtn = -102
  43.     exit
  44.   elseif valtype(aobnm)<>'A'.AND.aobnm<>nil
  45.     rtn = -103
  46.     exit
  47.   elseif valtype(aobtp)<>'A'.AND.aobtp<>nil
  48.     rtn = -104
  49.     exit
  50.   endi
  51.  
  52.   * Set up defaults
  53.   mobnm = if(obnm=nil,'*',alltrim(obnm))
  54.  
  55.   rtn = BDOBSN( obtp, mobnm,.F.,@arobid,@arobtp,@arobnm)  // SEGUE API
  56.   if rtn<0.or.empty(arobnm)
  57.     exit
  58.   endi
  59.  
  60.   for i=1 to len(arobnm)
  61.     if arobid[i]=0.or.arobnm[i]=nil.or. empty(arobnm[i])
  62.       arobnm[i]=nil
  63.       arobid[i]=0
  64.       loop
  65.     endi
  66.     exitflag=.F.
  67.     asize(arprvl,0) // reset array size
  68.     rtn1 = BDPTVLRD(, arobid[i], pnam, @arprvl)  // SEGUE API
  69.     if rtn1 < 0 .or. empty(arprvl) // check to see if it has a SECURITY_EQUALS property
  70.       arobnm[i]=nil
  71.       arobid[i]=0
  72.       asize(arprvl,0) // reset array size
  73.       loop
  74.     endi
  75.  
  76.     // property values of SECURITY_EQUALS
  77.  
  78.     for j=1 to len(arprvl)
  79.       mvalue = arprvl[j]  // value string
  80.  
  81.       for k=1 to 125 step 4
  82.         if dosl2bid(mvalue,k)<>1  // convert substring to object id
  83.           loop
  84.         endi
  85.  
  86.         * If object has supervisor equivalence add name to passed array then delete from temp list.
  87.         if valtype(arobnm[i])='C'
  88.           aadd(aobnm, arobnm[i])
  89.           aadd(aobid, arobid[i])
  90.           aadd(aobtp, arobtp[i])
  91.         endi
  92.         arobnm[i]=nil
  93.         asize(arprvl,0) // reset array size
  94.         exitflag=.T.
  95.         EXIT
  96.       NEXT
  97.       If exitflag
  98.         exit
  99.       endi
  100.     NEXT
  101.   next
  102.   * THE FOLLOWING SCANS REMAINING OBJECTS TO SEE IF ANY HAVE SECURITY EQUALS SET TO
  103.   * ANOTHER USER WHO HAS SUPERVISOR EQUIVALENCES AND ADDS THEM TO THE LIST
  104.   * OF THOSE WITH SUPERVISOR EQUIVALENCES.
  105.   mpassbg=len(aobnm)
  106.   mpassen=mpassbg+1
  107.   do while mpassbg<>mpassen
  108.     mpassbg = mpassbg+1
  109.     for i=1 to len(aobnm) // for each name in the supervisors list
  110.  
  111.       for j=1 to len(arobnm) // for each name in the list of users not in supervisors list
  112.         if arobnm[j]=nil
  113.           loop
  114.         endi
  115.  
  116.         exitflag=.F.
  117.         asize(arprvl,0) // reset array size
  118.         rtn1 = BDPTVLRD(, arobid[j], pnam, @arprvl)  // each property value SEGUE API
  119.         if rtn1 < 0 .or. empty(arprvl)// check to see if it has a SECURITY_EQUALS property
  120.           asize(arprvl,0) // reset array size
  121.           loop
  122.         endi                 // check to see if it has a SECURITY_EQUALS property [line: 119]
  123.         for k=1 to len(arprvl) // each segment is in an array
  124.           mvalue = arprvl[k]
  125.  
  126.           for l=1 to 125 step 4    // for each segment value id (four bytes)
  127.  
  128.             if  dosl2bid(mvalue,l) <> aobid[i] // if not security equivalent, skip
  129.               loop
  130.             endi              // if not security equivalent, skip
  131.             * Object has equivalence to object with supervisor equivalence, add name to passed array then delete from temp list.
  132.             if valtype(arobnm[j])='C'
  133.               aadd(aobnm, arobnm[j])
  134.               aadd(aobid, arobid[j])
  135.               aadd(aobtp, arobtp[j])
  136.               mpassen=mpassen+1
  137.             endi
  138.             arobnm[j] = nil
  139.             asize(arprvl,0) // reset array size
  140.             exitflag=.T.
  141.             EXIT
  142.           NEXT
  143.           if exitflag
  144.             EXIT
  145.           endi
  146.         NEXT                  // for each segment value id (four bytes)
  147.       NEXT
  148.     NEXT                      // each segment is in an array
  149.     exit
  150.   endd
  151.   EXIT
  152. endd                         // for each name in the list of users not in supervisors list [line: 111]
  153.  
  154. RETURN rtn
  155.